package org.traccar.protocol;

import org.junit.jupiter.api.Test;
import org.traccar.ProtocolTest;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class GoSafeFrameDecoderTest extends ProtocolTest {

    @Test
    public void testDecode() throws Exception {

        var decoder = inject(new GoSafeFrameDecoder());

        assertEquals(
                binary("2a475330362c3836303037383032343230363834342c3037343932393235303631392c2c5359533a473353433b56332e33373b56312e312e382c4750533a413b31303b4e332e3030393533343b453130312e3531323039363b333b3138383b33313b302e37302c434f543a32373337363637312c4144433a32352e36323b342e33373b322e35312c4454543a353030343b45313b303b303b303b3323"),
                decoder.decode(null, null, binary("2a475330362c3836303037383032343230363834342c3037343932393235303631392c2c5359533a473353433b56332e33373b56312e312e382c4750533a413b31303b4e332e3030393533343b453130312e3531323039363b333b3138383b33313b302e37302c434f543a32373337363637312c4144433a32352e36323b342e33373b322e35312c4454543a353030343b45313b303b303b303b3323")));

        assertEquals(
                binary("f80601013fb82203661b2ee46249007a13003f45feefeeb401db1bbe00000000060e00d602018904036412080c010111e121003100410051010807000000000000004655f8"),
                decoder.decode(null, null, binary("f80601013fb82203661b002ee46249007a13003f45feefeeb401db1b00be00000000060e00d602018904036412080c010111e121003100410051010807000000000000004655f8")));

    }

}
